package org.lboot.flow.module.audit;


import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import org.hibernate.Hibernate;
import org.lboot.jpa.entity.BaseEntity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Objects;

/**
 * @author kindear
 * 流程审计记录
 */
@Getter
@Setter
@ToString
@RequiredArgsConstructor
@Entity
@Table(name = "flow_audit")
@ApiModel(value = "流程审计")
public class FlowAudit extends BaseEntity implements Serializable {

    @ApiModelProperty(value = "流程实例ID")
    @Column(name = "flow_work_id")
    String flowWorkId;

    @ApiModelProperty(value = "审计节点ID")
    @Column(name = "flow_node_id")
    String flowNodeId;

    // 2024-09-21 新增审计节点名称
    @ApiModelProperty(value = "审计节点名称")
    @Column(name = "flow_node_name")
    String flowNodeName;

    @ApiModelProperty(value = "审计节点类型")
    @Column(name = "flow_node_type")
    String flowNodeType;

    @ApiModelProperty(value = "审计结果")
    @Column(name = "audit_result")
    String auditResult;

    @ApiModelProperty(value = "流程审计意见")
    @Column(name = "remark")
    String remark;


    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
        FlowAudit flowAudit = (FlowAudit) o;
        return id != null && Objects.equals(id, flowAudit.id);
    }

    @Override
    public int hashCode() {
        return getClass().hashCode();
    }
}
